function theta = trainLinearReg(X, y, lambda)

    initial_theta = zeros(size(X, 2) + 1, 1);

    costFunction = @(t) linearRegCostFunction(t, X, y, lambda);

    options = optimset('MaxIter', 200, 'GradObj', 'on');

    theta = fmincg(costFunction, initial_theta, options);
end
